package 剑指offer_leetcode;

public class 剑指Offer53_ll_0_n_1中缺失的数字 {
    //二分法
    public int missingNumber(int[] nums) {
        int left = 0;
        int right = nums.length - 1;
        while(left<=right){
            int mid = (left+right) / 2;
            if(nums[mid] == mid)
                left = mid + 1;
            else
                right = mid - 1;
        }
        return left;
    }
}
